import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/login/login.vue'
import IndexView from '../views/home/index.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/index',
    name: 'index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/home/index.vue')
  },
  {
    path: "/system",
    name: "system",
    meta: { title: "系统管理", icon: "Tools", hidden: false },
    component: IndexView,
    children: [
      {
        path: '/system/menus',
        name: 'menus',
        component: () => import('../views/system/menus.vue')
      },
      {
        path: '/system/roles',
        name: 'roles',
        component: () => import('../views/system/roles.vue')
      },
      {
        path: '/system/users',
        name: 'users',
        component: () => import('../views/system/users.vue')
      },
    ]
  },
  {
    path: "/goods",
    name: "goods",
    meta: { title: "商品", icon: "Tools", hidden: false },
    component: IndexView,
    children: [
      {
        path: '/goods/material',
        name: 'material',
        component: () => import('../views/goods/material.vue')
      },
      {
        path: '/goods/goodsClassify',
        name: 'goodsClassify',
        component: () => import('../views/goods/goodsClassify.vue')
      },
      {
        path: '/goods/goodsRule',
        name: 'goodsRule',
        component: () => import('../views/goods/goodsRule.vue')
      },
      {
        path: '/goods/manage',
        name: 'manage',
        component: () => import('../views/goods/goodsManager.vue')
      },
      {
        path: '/goods/goodsEdit',
        name: 'goodsEdit',
        component: () => import('../views/goods/goodsEdit.vue')
      },
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
